package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.service.store.awk.bean.BigBannerCardBean;
import com.huawei.appmarket.service.store.awk.bean.BigBannerItemBean;
import java.util.ArrayList;
import java.util.List;
import o.cgz;
import o.chy;
import o.eib;
import o.ewm.d;
import o.ewm.h;
import o.ewm.j;

public class BigImageBannerCard extends BaseDistCard {
    private ArrayList<BigImageBannerItemCard> ˋ;

    public BigImageBannerCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        LinearLayout linearLayout = (LinearLayout) view.findViewById(j.ﾟॱ);
        linearLayout.setPadding(eib.ॱॱ(), 0, eib.ʽ(), 0);
        int ˎ = ˎ();
        int dimensionPixelSize = this.ʼॱ.getResources().getDimensionPixelSize(d.ˋʻ);
        LayoutInflater from = LayoutInflater.from(this.ʼॱ);
        this.ˋ = new ArrayList();
        for (int i = 0; i < ˎ; i++) {
            View inflate = from.inflate(h.ˋﾟ, null);
            BigImageBannerItemCard bigImageBannerItemCard = new BigImageBannerItemCard(this.ʼॱ);
            bigImageBannerItemCard.ˏ(inflate);
            this.ˋ.add(bigImageBannerItemCard);
            LayoutParams layoutParams = (LayoutParams) inflate.getLayoutParams();
            if (i > 0) {
                layoutParams.setMarginStart(dimensionPixelSize);
            }
            linearLayout.addView(inflate, layoutParams);
        }
        ʽ(view);
        return this;
    }

    private int ˎ() {
        return eib.ˊॱ();
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof BigBannerCardBean) {
            BigBannerCardBean bigBannerCardBean = (BigBannerCardBean) cardBean;
            int ˎ = ˎ();
            for (int i = 0; i < ˎ; i++) {
                BigImageBannerItemCard bigImageBannerItemCard = (BigImageBannerItemCard) this.ˋ.get(i);
                if (i < bigBannerCardBean.ʻˋ().size()) {
                    CardBean cardBean2 = (BigBannerItemBean) bigBannerCardBean.ʻˋ().get(i);
                    cardBean2.ˋˋ(bigBannerCardBean.ॱˉ());
                    bigImageBannerItemCard.ˏ(cardBean2);
                    bigImageBannerItemCard.ˉ().setVisibility(0);
                } else {
                    bigImageBannerItemCard.ˉ().setVisibility(4);
                }
            }
        }
    }

    public void ॱ(chy o_chy) {
        int ˎ = ˎ();
        for (int i = 0; i < ˎ; i++) {
            ((BigImageBannerItemCard) this.ˋ.get(i)).ॱ(o_chy);
        }
    }

    public ArrayList<String> ˋ() {
        ArrayList<String> arrayList = new ArrayList();
        if (this.ˊᐝ instanceof BigBannerCardBean) {
            List ʻˋ = ((BigBannerCardBean) this.ˊᐝ).ʻˋ();
            if (ʻˋ != null) {
                int i = 0;
                while (i < this.ˋ.size() && i < ʻˋ.size()) {
                    BigBannerItemBean bigBannerItemBean = (BigBannerItemBean) ʻˋ.get(i);
                    arrayList.add(bigBannerItemBean.ॱॱ() + "#$#" + bigBannerItemBean.u_());
                    i++;
                }
            }
        }
        return arrayList;
    }
}
